#ifndef CTRLBOX_H
#define CTRLBOX_H

#include <string>


class CtrlBoxPrivate;
class CtrlBox
{
public:
    CtrlBox();
    ~CtrlBox();

    void setServerAddress( const std::string& add , int port );
    void setLocalAddress( const std::string& add , int port );

    std::string getLocalAddress();
    int getLocalPort();

    std::string getServerAddress();
    int getServerPort();

    bool openHost();

    bool isOpend();

    void clostHost();

    bool sendData(const char *data , int dataLen);

    //会阻塞，直到读入数据,返回的char*数据需要手动释放
    char* readData(unsigned int size);

private:
    CtrlBoxPrivate *dCtrlBox;
};

#endif // CTRLBOX_H
